package org.cocos2dx.javascript;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;

import com.hb.api.HbSplashActivity;
import com.hb.api.HbSplashMgr;
import com.hbsdk.Ut;
import com.hbsdk.ad.HbAdError;
import com.hbsdk.ad.IHbAdListener;

    public class MySplashActivity extends HbSplashActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showSplash();
    }

    private void showSplash(){

        //展示广告之前,先创建闪屏
        HbSplashMgr.getInstance().createSplash(new IHbAdListener() {
            @Override
            public void onAdShow() {
                Ut.logD("Splash onAdShow...");
            }
            @Override
            public void onAdFailed(HbAdError error) {
                Log.d("WDNativePlatformTT","Splash show fail:" + error.toString());
            }
            @Override
            public void onAdReady() {
                Log.d("WDNativePlatformTT","Splash onAdReady..." );
            }
            @Override
            public void onAdClick() {
                Ut.logD("Splash onAdClick...");
            }
            @Override
            public void onAdDismissed() {
                Ut.logD("Splash onAdDismissed...");
            }
            @Override
            public void onAdReward() {
            }
        });

        //设置开屏广告结束后要跳转的activity全类名，为null就读取接入方在hb_strings.xml填写的activity全类名
        //MainActivity.class.getName() MainActivity代指主界面activity。请修改为真正的主activity。
        HbSplashMgr.getInstance().setSplashEntryClsNm(null);
        Log.d("WDNativePlatformTT","展示闪屏---->==============================");
        //传入posID,展示广告
        HbSplashMgr.getInstance().showSplash(Config.SplashId);
    }
}